﻿@model SuCasa.Models.AddStudentToCourseViewModel

@{
    ViewBag.Title = "AddStudentToCourse";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<h1>Course:@Model.CourseName</h1>
<div><h2><small>Search for a student to add to course</small> </h2></div>

@using (Html.BeginForm("StudentSearch", "Course", FormMethod.Post, new { @class = "form-horizontal" }))
{
     @Html.HiddenFor(x => x.CourseId)
     <div class="input-prepend">
         @Html.TextBoxFor(x => x.SearchStr, new {@class = "span2"})
     </div>


     <div id="results" style="padding-top:20px;">
         @if (Model.SearchResults != null)
         {
             <table class="table table-striped table-bordered">
                 <thead>
                     <tr>
                         <th></th>
                         <th>
                             Name
                         </th>
                      
                         <th>
                             Home Phone
                         </th>
                         <th>
                             Cell Phone
                         </th>
                         <th>
                             Email
                         </th>
                     </tr>
                 </thead>
                 <tbody>

                     @foreach (var item in Model.SearchResults)
                     {
                         <tr>
                             <td>
                                 @Html.ActionLink("Add", "AddStudent", "Course", new {memberId = item.MemberId, courseId = Model.CourseId, searchStr = Model.SearchStr}, null) 
                              
                             </td>
                             <td>
                                 @item.Name
                             </td>
                       
                             <td>
                                 @item.HomePhone
                             </td>
                             <td>
                                 @item.CellPhone
                             </td>
                             <td>
                                 @item.Email
                             </td>
                         </tr>
                     }
                 </tbody>
             </table>
         }
     </div>
 }